<template>
<div>
  <input type="text" :value="content" @input="contentChange">
  <button @click="add">添加</button>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'

export default defineComponent({
  emits: ["addTodoItem"],
  setup(_, {emit}) {
    const content = ref('')
    const contentChange = (e: any) => {
      content.value = e.target.value      
    }

    const add = () => {
      emit('addTodoItem', content.value)
      content.value = ''
    }

    return {
      content,
      contentChange,
      add
    }
  },

  methods: {

  }
})
</script>